package com.shihb.principle.singlerposibility;/**
 *Description:
 *Version:1.0.0
 *@author shihb
 *@date 2020/6/23 20:51
 */
public class Demo3 {

  public static void main(String[] args) {
    AnimalNew animal = new AnimalNew();
    animal.run("金钱豹");
    animal.fly("鸟");
    animal.swim("鱼");

  }
}

/**
 * 当类实现的功能比较少的时候可以通过在方法满足单一职责即可
 */
class AnimalNew{
  public void run(String animal){
    System.out.println(animal+"正在跑");
  }
  public void swim(String animal){
    System.out.println(animal+"正在游");
  }
  public void fly(String animal){
    System.out.println(animal+"正在飞");
  }
}
